home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
answrbok
/
3_5.lha
/
3_5
/
3_5a2.c
< prev
next >
Wrap
Text File
|
1993-08-08
|
500b
|
23 lines
* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
* The C++ Answer Book */
* Tony Hansen */
* All rights reserved. */
/ exercise overflow and underflow
include <stream.h>
include <limits.h>
nt main(int, char**)
short int i;
i = SHRT_MAX;
cout << "SHRT_MAX=" << i << "\n";
i++; // overflow
cout << "SHRT_MAX+1=" << i << "\n";
i = SHRT_MIN;
cout << "SHRT_MIN=" << i << "\n";
i--; // underflow
cout << "SHRT_MIN-1=" << i << "\n";
return 0;